package com.sen.pro.switches.admin.util;

import java.io.File;
import java.io.FileFilter;

import com.sen.pro.switches.core.cfg.ENV;
import com.sen.pro.switches.core.common.Constants;

/**
 * 上传文件工具类
 * 
 * @author tianqingsen
 */
public class UploadFileUtil {
	
	/**
	 * 上传文件保存的根目录，该目录是相对web工程根目录的
	 */
	public static final String ROOT_PATH = ENV.UPLOAD_DIR;
	
	/**
	 * 路劲分隔符
	 */
	private static final String PATH_SP = "/";
	
	public static void main(String[] args) {
		final String logoImgName = Constants.LOGO_IMG_NAME;
		String scanPath = "D:/Projects/workspace/sen/sen-pro-switches/src/main/webapp/data/img";
		File file = new File(scanPath);
		File[] imgs = file.listFiles(new FileFilter() {
			@Override
			public boolean accept(File file) {
				if (file.getName().indexOf(logoImgName) >= 0) {
					return true;
				}
				return false;
			}
		});
		
		System.out.println(imgs.length);
	}
	
}
